package com.bwhx.eruler.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.bwhx.eruler.bean.Department;
import com.bwhx.eruler.bean.Page;
import com.bwhx.eruler.dao.DepartmentDao;

/**
 * @Description:
 */
@Repository
public class DepartmentDaoImpl extends BaseDaoImpl<Department> implements DepartmentDao {
	public DepartmentDaoImpl() {
		this.setNs("com.bwhx.eruler.mapper.DepartmentMapper.");
	}


	public List<Department> findByName(String deptname) {
	
		return getSqlSession().selectList("com.bwhx.eruler.mapper.DepartmentMapper." + "findByName", deptname);
	}


	

	@Override
	public void inputDepartment(Department d) {
		this.getSqlSession().update("com.bwhx.eruler.mapper.DepartmentMapper." + "updateruler", d);
		
		
	}

	@Override
	public List<Department> list(Page p) {
		return getSqlSession().selectList("com.bwhx.eruler.mapper.DepartmentMapper." + "list",p);

	}


	@Override
	public Integer count(Department d) {
		Object selectOne = getSqlSession().selectOne("com.bwhx.eruler.mapper.DepartmentMapper." + "count",d);
		if(null!=selectOne && selectOne instanceof Integer){
			return (int)selectOne;
		}
		return 0;
	}


	@Override
	public List<Department> deptListAll() {
		return getSqlSession().selectList("com.bwhx.eruler.mapper.DepartmentMapper." + "listAll");

	}


	@Override
	public void del(String dId) {
		getSqlSession().update("com.bwhx.eruler.mapper.DepartmentMapper." + "del",dId);
		
	}
	
}
